package org.altervista.cp.thinjdbc.wrappers;

import java.io.InputStream;
import java.io.Reader;
import java.sql.Blob;
import java.sql.Clob;
import java.sql.NClob;
import java.sql.RowId;
import java.sql.SQLException;
import java.sql.SQLXML;

public abstract class CallableStatement4 extends CallableStatement {

	public void setAsciiStream(String parameterName, InputStream x, long length) {
		new AsciiStreamParameter(parameterName, x, length).setParameter();
	}

	public void setAsciiStream(String parameterName, InputStream x) {
		new AsciiStreamParameter(parameterName, x).setParameter();
	}

	public void setBinaryStream(String parameterName, InputStream x, long length) {
		new BinaryStreamParameter(parameterName, x, length).setParameter();
	}

	public void setBinaryStream(String parameterName, InputStream x) {
		new BinaryStreamParameter(parameterName, x).setParameter();
	}

	public void setBlob(String parameterName, Blob x) {
		new Blob2Parameter(parameterName, x).setParameter();
	}

	public void setBlob(String parameterName, InputStream inputStream,
			long length) {
		new BlobParameter(parameterName, inputStream, length).setParameter();
	}

	public void setBlob(String parameterName, InputStream inputStream) {
		new BlobParameter(parameterName, inputStream).setParameter();
	}

	public void setCharacterStream(String parameterName, Reader reader,
			long length) {
		new CharacterStreamParameter(parameterName, reader, length)
				.setParameter();
	}

	public void setCharacterStream(String parameterName, Reader reader) {
		new CharacterStreamParameter(parameterName, reader).setParameter();
	}

	public void setClob(String parameterName, Clob x) {
		new Clob2Parameter(parameterName, x).setParameter();
	}

	public void setClob(String parameterName, Reader reader, long length) {
		new ClobParameter(parameterName, reader, length).setParameter();
	}

	public void setClob(String parameterName, Reader reader) {
		new ClobParameter(parameterName, reader).setParameter();
	}

	public void setNCharacterStream(String parameterName, Reader reader,
			long length) {
		new NCharacterStreamParameter(parameterName, reader, length)
				.setParameter();
	}

	public void setNCharacterStream(String parameterName, Reader reader) {
		new NCharacterStreamParameter(parameterName, reader).setParameter();
	}

	public void setNClob(String parameterName, NClob value) {
		new NClob2Parameter(parameterName, value).setParameter();
	}

	public void setNClob(String parameterName, Reader reader, long length) {
		new NClobParameter(parameterName, reader, length).setParameter();
	}

	public void setNClob(String parameterName, Reader reader) {
		new NClobParameter(parameterName, reader).setParameter();
	}

	public void setNString(String parameterName, String value) {
		new NStringParameter(parameterName, value).setParameter();
	}

	public void setRowId(String parameterName, RowId x) {
		new RowIdParameter(parameterName, x).setParameter();
	}

	public void setSQLXML(String parameterName, SQLXML xmlObject) {
		new SQLXMLParameter(parameterName, xmlObject).setParameter();
	}

	public abstract Reader getCharacterStream(int parameterIndex);

	public abstract Reader getCharacterStream(String parameterName);

	public abstract Reader getNCharacterStream(int parameterIndex);

	public abstract Reader getNCharacterStream(String parameterName);

	public abstract NClob getNClob(int parameterIndex);

	public abstract NClob getNClob(String parameterName);

	public abstract String getNString(int parameterIndex);

	public abstract String getNString(String parameterName);

	public abstract RowId getRowId(int parameterIndex);

	public abstract RowId getRowId(String parameterName);

	public abstract SQLXML getSQLXML(int parameterIndex);

	public abstract SQLXML getSQLXML(String parameterName);

	protected class AsciiStreamParameter extends NamedParameter<InputStream> {
		protected AsciiStreamParameter(String parameterName, InputStream value,
				Object... args) {
			super(parameterName, value, args);
		}

		protected void set() throws SQLException {
			if (_args == null || _args.length == 0) {
				((java.sql.CallableStatement) unwrap()).setAsciiStream(
						_parameterName, _value);
			} else {
				((java.sql.CallableStatement) unwrap()).setAsciiStream(
						_parameterName, _value, (Long) _args[0]);
			}
		}
	}

	protected class BinaryStreamParameter extends NamedParameter<InputStream> {
		protected BinaryStreamParameter(String parameterName,
				InputStream value, Object... args) {
			super(parameterName, value, args);
		}

		protected void set() throws SQLException {
			if (_args == null || _args.length == 0) {
				((java.sql.CallableStatement) unwrap()).setBinaryStream(
						_parameterName, _value);
			} else {
				((java.sql.CallableStatement) unwrap()).setBinaryStream(
						_parameterName, _value, (Long) _args[0]);
			}
		}
	}

	protected class BlobParameter extends NamedParameter<InputStream> {
		protected BlobParameter(String parameterName, InputStream value,
				Object... args) {
			super(parameterName, value, args);
		}

		protected void set() throws SQLException {
			if (_args == null || _args.length == 0) {
				((java.sql.CallableStatement) unwrap()).setBlob(_parameterName,
						_value);
			} else {
				((java.sql.CallableStatement) unwrap()).setBlob(_parameterName,
						_value, (Long) _args[0]);
			}
		}
	}

	protected class Blob2Parameter extends NamedParameter<Blob> {
		protected Blob2Parameter(String parameterName, Blob value,
				Object... args) {
			super(parameterName, value, args);
		}

		protected void set() throws SQLException {
			((java.sql.CallableStatement) unwrap()).setBlob(_parameterName,
					_value);
		}
	}

	protected class CharacterStreamParameter extends NamedParameter<Reader> {
		protected CharacterStreamParameter(String parameterName, Reader value,
				Object... args) {
			super(parameterName, value, args);
		}

		protected void set() throws SQLException {
			if (_args == null || _args.length == 0) {
				((java.sql.CallableStatement) unwrap()).setCharacterStream(
						_parameterName, _value);
			} else {
				((java.sql.CallableStatement) unwrap()).setCharacterStream(
						_parameterName, _value, (Long) _args[0]);
			}
		}
	}

	protected class ClobParameter extends NamedParameter<Reader> {
		protected ClobParameter(String parameterName, Reader value,
				Object... args) {
			super(parameterName, value, args);
		}

		protected void set() throws SQLException {
			if (_args == null || _args.length == 0) {
				((java.sql.CallableStatement) unwrap()).setClob(_parameterName,
						_value);
			} else {
				((java.sql.CallableStatement) unwrap()).setClob(_parameterName,
						_value, (Long) _args[0]);
			}
		}
	}

	protected class Clob2Parameter extends NamedParameter<Clob> {
		protected Clob2Parameter(String parameterName, Clob value,
				Object... args) {
			super(parameterName, value, args);
		}

		protected void set() throws SQLException {
			((java.sql.CallableStatement) unwrap()).setClob(_parameterName,
					_value);
		}
	}

	protected class NCharacterStreamParameter extends NamedParameter<Reader> {
		protected NCharacterStreamParameter(String parameterName, Reader value,
				Object... args) {
			super(parameterName, value, args);
		}

		protected void set() throws SQLException {
			if (_args == null || _args.length == 0) {
				((java.sql.CallableStatement) unwrap()).setNCharacterStream(
						_parameterName, _value);
			} else {
				((java.sql.CallableStatement) unwrap()).setNCharacterStream(
						_parameterName, _value, (Long) _args[0]);
			}
		}
	}

	protected class NClobParameter extends NamedParameter<Reader> {
		protected NClobParameter(String parameterName, Reader value,
				Object... args) {
			super(parameterName, value, args);
		}

		protected void set() throws SQLException {
			if (_args == null || _args.length == 0) {
				((java.sql.CallableStatement) unwrap()).setNClob(
						_parameterName, _value);
			} else {
				((java.sql.CallableStatement) unwrap()).setNClob(
						_parameterName, _value, (Long) _args[0]);
			}
		}
	}

	protected class NClob2Parameter extends NamedParameter<NClob> {
		protected NClob2Parameter(String parameterName, NClob value,
				Object... args) {
			super(parameterName, value, args);
		}

		protected void set() throws SQLException {
			((java.sql.CallableStatement) unwrap()).setClob(_parameterName,
					_value);
		}
	}

	protected class NStringParameter extends NamedParameter<String> {
		protected NStringParameter(String parameterName, String value,
				Object... args) {
			super(parameterName, value, args);
		}

		protected void set() throws SQLException {
			((java.sql.CallableStatement) unwrap()).setNString(_parameterName,
					_value);
		}
	}

	protected class RowIdParameter extends NamedParameter<RowId> {
		protected RowIdParameter(String parameterName, RowId value,
				Object... args) {
			super(parameterName, value, args);
		}

		protected void set() throws SQLException {
			((java.sql.CallableStatement) unwrap()).setRowId(_parameterName,
					_value);
		}
	}

	protected class SQLXMLParameter extends NamedParameter<SQLXML> {
		protected SQLXMLParameter(String parameterName, SQLXML value,
				Object... args) {
			super(parameterName, value, args);
		}

		protected void set() throws SQLException {
			((java.sql.CallableStatement) unwrap()).setSQLXML(_parameterName,
					_value);
		}
	}

}
